home *** CD-ROM | disk | FTP | other *** search
MacBinary | 1987-06-03 | 2.3 KB | [TEXT/MPS ] |
open in:
MacOS 8.1
|
Win98
|
DOS
view JSON data
|
view as text
This file was processed as: MacBinary
(archive/macBinary).
You can browse this item here: File.c
id metadata |
---|
key | value |
---|
macFileType | [TEXT] |
macFileCreator | [MPS ] |
hex view+--------+-------------------------+-------------------------+--------+--------+
|00000000| 00 06 46 69 6c 65 2e 63 | 00 00 00 00 00 00 00 00 |..File.c|........|
|00000010| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000020| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000030| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000040| 00 54 45 58 54 4d 50 53 | 20 00 00 00 00 00 00 00 |.TEXTMPS| .......|
|00000050| 00 00 00 00 00 06 d5 00 | 00 01 7e 9c ea 71 24 9c |........|..~..q$.|
|00000060| ea 71 24 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |.q$.....|........|
|00000070| 00 00 00 00 00 00 00 00 | 00 00 81 81 86 9d 00 00 |........|........|
|00000080| 2f 2a 20 54 68 69 73 20 | 66 69 6c 65 20 63 6f 6e |/* This |file con|
|00000090| 74 61 69 6e 73 20 63 61 | 6c 6c 73 20 74 6f 20 73 |tains ca|lls to s|
|000000a0| 74 61 6e 64 61 72 64 20 | 66 69 6c 65 20 61 6c 6f |tandard |file alo|
|000000b0| 6e 67 20 77 69 74 68 20 | 66 69 6c 65 20 6f 70 65 |ng with |file ope|
|000000c0| 6e 73 20 2a 2f 0d 2f 2a | 0d 20 20 20 41 75 74 68 |ns */./*|. Auth|
|000000d0| 6f 72 3a 20 4a 65 72 72 | 79 20 4c 65 56 61 6e 0d |or: Jerr|y LeVan.|
|000000e0| 20 20 20 09 09 09 33 32 | 35 20 42 6f 6f 6e 65 20 | ...32|5 Boone |
|000000f0| 54 72 61 69 6c 0d 09 09 | 09 52 69 63 68 6d 6f 6e |Trail...|.Richmon|
|00000100| 64 20 4b 79 20 34 30 34 | 37 35 0d 2a 2f 0d 23 69 |d Ky 404|75.*/.#i|
|00000110| 6e 63 6c 75 64 65 20 3c | 70 61 63 6b 61 67 65 73 |nclude <|packages|
|00000120| 2e 68 3e 0d 23 69 6e 63 | 6c 75 64 65 20 3c 66 69 |.h>.#inc|lude <fi|
|00000130| 6c 65 73 2e 68 3e 0d 23 | 69 6e 63 6c 75 64 65 20 |les.h>.#|include |
|00000140| 3c 65 72 72 6f 72 73 2e | 68 3e 0d 0d 42 6f 6f 6c |<errors.|h>..Bool|
|00000150| 65 61 6e 20 4f 6b 54 6f | 53 65 6e 64 46 69 6c 65 |ean OkTo|SendFile|
|00000160| 28 66 72 65 66 29 0d 20 | 73 68 6f 72 74 20 2a 66 |(fref). |short *f|
|00000170| 72 65 66 3b 09 2f 2a 20 | 63 68 61 6e 6e 65 6c 20 |ref;./* |channel |
|00000180| 69 66 20 61 6c 6c 20 67 | 6f 65 73 20 77 65 6c 6c |if all g|oes well|
|00000190| 20 2a 2f 0d 20 7b 0d 20 | 20 20 20 50 6f 69 6e 74 | */. {. | Point|
|000001a0| 20 6c 6f 63 3b 0d 20 20 | 20 20 53 46 54 79 70 65 | loc;. | SFType|
|000001b0| 4c 69 73 74 20 74 79 70 | 65 4c 69 73 74 3b 0d 20 |List typ|eList;. |
|000001c0| 20 20 20 53 46 52 65 70 | 6c 79 20 72 65 70 6c 79 | SFRep|ly reply|
|000001d0| 3b 0d 20 20 20 20 73 68 | 6f 72 74 20 6e 74 79 70 |;. sh|ort ntyp|
|000001e0| 65 73 3b 0d 09 73 68 6f | 72 74 20 65 72 72 3b 0d |es;..sho|rt err;.|
|000001f0| 20 20 20 20 0d 20 20 20 | 20 6c 6f 63 2e 76 20 3d | . | loc.v =|
|00000200| 20 38 30 3b 0d 20 20 20 | 20 6c 6f 63 2e 68 20 3d | 80;. | loc.h =|
|00000210| 20 31 30 30 3b 0d 20 20 | 20 20 6e 74 79 70 65 73 | 100;. | ntypes|
|00000220| 20 3d 20 31 3b 20 0d 20 | 20 20 20 0d 20 20 20 20 | = 1; . | . |
|00000230| 74 79 70 65 4c 69 73 74 | 5b 30 5d 20 3d 20 27 54 |typeList|[0] = 'T|
|00000240| 45 58 54 27 3b 0d 20 20 | 20 20 0d 20 20 20 20 53 |EXT';. | . S|
|00000250| 46 47 65 74 46 69 6c 65 | 28 26 6c 6f 63 2c 20 30 |FGetFile|(&loc, 0|
|00000260| 2c 20 30 2c 20 6e 74 79 | 70 65 73 2c 20 74 79 70 |, 0, nty|pes, typ|
|00000270| 65 4c 69 73 74 2c 20 30 | 2c 20 26 72 65 70 6c 79 |eList, 0|, &reply|
|00000280| 29 3b 0d 20 20 20 20 0d | 20 20 20 20 69 66 28 20 |);. .| if( |
|00000290| 72 65 70 6c 79 2e 67 6f | 6f 64 20 29 7b 0d 09 20 |reply.go|od ){.. |
|000002a0| 09 20 20 20 70 32 63 73 | 74 72 28 26 72 65 70 6c |. p2cs|tr(&repl|
|000002b0| 79 2e 66 4e 61 6d 65 29 | 3b 20 2f 2a 20 66 69 78 |y.fName)|; /* fix|
|000002c0| 20 66 6f 72 20 66 75 72 | 74 68 65 72 20 68 69 67 | for fur|ther hig|
|000002d0| 68 20 6c 65 76 65 6c 20 | 63 61 6c 6c 73 20 2a 2f |h level |calls */|
|000002e0| 0d 09 09 20 20 20 2f 2a | 20 6e 6f 77 20 74 72 79 |... /*| now try|
|000002f0| 20 74 68 65 20 6f 70 65 | 6e 20 2a 2f 0d 09 09 20 | the ope|n */... |
|00000300| 20 20 69 66 28 65 72 72 | 20 3d 20 46 53 4f 70 65 | if(err| = FSOpe|
|00000310| 6e 28 26 72 65 70 6c 79 | 2e 66 4e 61 6d 65 2c 72 |n(&reply|.fName,r|
|00000320| 65 70 6c 79 2e 76 52 65 | 66 4e 75 6d 2c 66 72 65 |eply.vRe|fNum,fre|
|00000330| 66 29 29 7b 0d 09 09 20 | 20 20 20 09 45 72 72 6f |f)){... | .Erro|
|00000340| 72 4d 65 73 73 61 67 65 | 28 22 43 61 6e 27 74 20 |rMessage|("Can't |
|00000350| 4f 70 65 6e 20 54 65 78 | 74 20 46 69 6c 65 22 2c |Open Tex|t File",|
|00000360| 65 72 72 29 3b 0d 09 09 | 20 20 20 09 09 72 65 74 |err);...| ..ret|
|00000370| 75 72 6e 20 66 61 6c 73 | 65 3b 7d 0d 09 09 20 20 |urn fals|e;}... |
|00000380| 20 72 65 74 75 72 6e 20 | 74 72 75 65 3b 0d 09 09 | return |true;...|
|00000390| 20 20 7d 0d 09 65 6c 73 | 65 20 72 65 74 75 72 6e | }..els|e return|
|000003a0| 20 66 61 6c 73 65 3b 0d | 20 7d 0d 0d 42 6f 6f 6c | false;.| }..Bool|
|000003b0| 65 61 6e 20 4f 6b 54 6f | 52 65 63 65 69 76 65 46 |ean OkTo|ReceiveF|
|000003c0| 69 6c 65 28 66 72 65 66 | 2c 76 72 65 66 2c 63 72 |ile(fref|,vref,cr|
|000003d0| 65 61 74 6f 72 29 0d 20 | 20 73 68 6f 72 74 20 2a |eator). | short *|
|000003e0| 66 72 65 66 3b 09 2f 2a | 20 72 65 74 75 72 6e 65 |fref;./*| returne|
|000003f0| 64 20 63 68 61 6e 6e 65 | 6c 20 2a 2f 0d 20 20 73 |d channe|l */. s|
|00000400| 68 6f 72 74 20 2a 76 72 | 65 66 3b 20 20 2f 2a 20 |hort *vr|ef; /* |
|00000410| 76 6f 6c 75 6d 65 20 72 | 65 66 20 66 6f 72 20 66 |volume r|ef for f|
|00000420| 6c 75 73 68 20 2a 2f 0d | 20 20 4f 53 54 79 70 65 |lush */.| OSType|
|00000430| 20 63 72 65 61 74 6f 72 | 3b 0d 20 20 7b 20 0d 20 | creator|;. { . |
|00000440| 20 20 20 53 46 52 65 70 | 6c 79 20 72 65 70 6c 79 | SFRep|ly reply|
|00000450| 3b 0d 20 20 20 20 50 6f | 69 6e 74 20 6c 6f 63 3b |;. Po|int loc;|
|00000460| 0d 09 73 68 6f 72 74 20 | 65 72 72 3b 0d 09 20 20 |..short |err;.. |
|00000470| 0d 20 20 20 20 20 20 6c | 6f 63 2e 76 20 3d 20 38 |. l|oc.v = 8|
|00000480| 30 3b 0d 20 20 20 20 20 | 20 6c 6f 63 2e 68 20 3d |0;. | loc.h =|
|00000490| 20 31 30 30 3b 0d 09 20 | 20 0d 20 20 20 20 53 46 | 100;.. | . SF|
|000004a0| 50 75 74 46 69 6c 65 28 | 26 6c 6f 63 2c 20 22 53 |PutFile(|&loc, "S|
|000004b0| 65 6c 65 63 74 20 4e 61 | 6d 65 22 2c 22 52 65 63 |elect Na|me","Rec|
|000004c0| 65 69 76 65 46 69 6c 65 | 2e 54 78 74 22 2c 20 6e |eiveFile|.Txt", n|
|000004d0| 69 6c 2c 20 26 72 65 70 | 6c 79 29 3b 0d 09 69 66 |il, &rep|ly);..if|
|000004e0| 28 72 65 70 6c 79 2e 67 | 6f 6f 64 29 7b 0d 09 20 |(reply.g|ood){.. |
|000004f0| 20 70 32 63 73 74 72 28 | 26 72 65 70 6c 79 2e 66 | p2cstr(|&reply.f|
|00000500| 4e 61 6d 65 29 3b 20 2f | 2a 20 63 6f 6e 76 65 72 |Name); /|* conver|
|00000510| 74 20 74 6f 20 63 20 73 | 74 72 69 6e 67 20 2a 2f |t to c s|tring */|
|00000520| 0d 09 20 20 69 66 28 65 | 72 72 3d 43 72 65 61 74 |.. if(e|rr=Creat|
|00000530| 65 28 26 72 65 70 6c 79 | 2e 66 4e 61 6d 65 2c 72 |e(&reply|.fName,r|
|00000540| 65 70 6c 79 2e 76 52 65 | 66 4e 75 6d 2c 63 72 65 |eply.vRe|fNum,cre|
|00000550| 61 74 6f 72 2c 27 54 45 | 58 54 27 29 29 0d 09 20 |ator,'TE|XT')).. |
|00000560| 20 20 20 69 66 28 65 72 | 72 21 3d 64 75 70 46 4e | if(er|r!=dupFN|
|00000570| 45 72 72 29 7b 0d 09 20 | 20 20 20 45 72 72 6f 72 |Err){.. | Error|
|00000580| 4d 65 73 73 61 67 65 28 | 22 43 61 6e 27 74 20 43 |Message(|"Can't C|
|00000590| 72 65 61 74 65 20 54 65 | 78 74 20 46 69 6c 65 22 |reate Te|xt File"|
|000005a0| 2c 65 72 72 29 3b 0d 09 | 09 72 65 74 75 72 6e 20 |,err);..|.return |
|000005b0| 66 61 6c 73 65 3b 7d 0d | 09 09 0d 09 20 20 69 66 |false;}.|.... if|
|000005c0| 28 65 72 72 20 3d 20 46 | 53 4f 70 65 6e 28 26 72 |(err = F|SOpen(&r|
|000005d0| 65 70 6c 79 2e 66 4e 61 | 6d 65 2c 72 65 70 6c 79 |eply.fNa|me,reply|
|000005e0| 2e 76 52 65 66 4e 75 6d | 2c 66 72 65 66 29 29 7b |.vRefNum|,fref)){|
|000005f0| 0d 09 20 20 20 20 45 72 | 72 6f 72 4d 65 73 73 61 |.. Er|rorMessa|
|00000600| 67 65 28 22 43 61 6e 27 | 74 20 4f 70 65 6e 20 54 |ge("Can'|t Open T|
|00000610| 65 78 74 20 46 69 6c 65 | 22 2c 65 72 72 29 3b 0d |ext File|",err);.|
|00000620| 09 09 72 65 74 75 72 6e | 20 66 61 6c 73 65 3b 7d |..return| false;}|
|00000630| 0d 09 09 0d 09 20 20 2f | 2a 20 74 72 75 6e 63 61 |..... /|* trunca|
|00000640| 74 65 20 74 68 65 20 66 | 69 6c 65 20 69 6e 20 63 |te the f|ile in c|
|00000650| 61 73 65 20 69 74 20 61 | 6c 72 65 61 64 79 20 65 |ase it a|lready e|
|00000660| 78 69 73 74 73 20 2a 2f | 0d 09 20 20 69 66 28 65 |xists */|.. if(e|
|00000670| 72 72 3d 53 65 74 45 4f | 46 28 2a 66 72 65 66 2c |rr=SetEO|F(*fref,|
|00000680| 30 29 29 7b 0d 09 20 20 | 20 20 45 72 72 6f 72 4d |0)){.. | ErrorM|
|00000690| 65 73 73 61 67 65 28 22 | 45 72 72 6f 72 20 54 72 |essage("|Error Tr|
|000006a0| 75 6e 63 61 74 69 6e 67 | 20 46 69 6c 65 22 2c 65 |uncating| File",e|
|000006b0| 72 72 29 3b 0d 09 09 72 | 65 74 75 72 6e 20 66 61 |rr);...r|eturn fa|
|000006c0| 6c 73 65 3b 7d 0d 09 09 | 0d 09 20 20 2f 2a 20 65 |lse;}...|.. /* e|
|000006d0| 76 65 72 79 74 68 69 6e | 67 20 69 73 20 6f 6b 20 |verythin|g is ok |
|000006e0| 69 66 20 77 65 20 67 65 | 74 20 68 65 72 65 20 2a |if we ge|t here *|
|000006f0| 2f 0d 09 20 20 2a 76 72 | 65 66 20 3d 20 72 65 70 |/.. *vr|ef = rep|
|00000700| 6c 79 2e 76 52 65 66 4e | 75 6d 3b 20 2f 2a 20 74 |ly.vRefN|um; /* t|
|00000710| 68 65 20 6f 70 65 6e 20 | 66 69 78 65 64 20 74 68 |he open |fixed th|
|00000720| 65 20 63 68 61 6e 6e 65 | 6c 20 2a 2f 0d 09 20 20 |e channe|l */.. |
|00000730| 72 65 74 75 72 6e 20 74 | 72 75 65 3b 0d 09 20 7d |return t|rue;.. }|
|00000740| 0d 09 20 72 65 74 75 72 | 6e 20 66 61 6c 73 65 3b |.. retur|n false;|
|00000750| 0d 20 7d 0d 0d 00 00 00 | 00 00 00 00 00 00 00 00 |. }.....|........|
|00000760| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000770| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000780| 00 00 01 00 00 00 01 4c | 00 00 00 4c 00 00 00 32 |.......L|...L...2|
|00000790| 24 46 4d 4f 56 00 00 00 | 01 49 43 4e 23 00 01 00 |$FMOV...|.ICN#...|
|000007a0| 00 7a 06 00 01 6b f1 46 | 52 45 46 00 01 00 00 4b |.z...k.F|REF....K|
|000007b0| 06 46 69 6c 65 2e 63 b4 | 02 00 00 00 50 61 72 74 |.File.c.|....Part|
|000007c0| 53 49 54 78 00 00 00 00 | 00 00 00 00 00 01 66 dc |SITx....|......f.|
|000007d0| 00 00 50 61 72 74 53 49 | 54 78 00 00 00 00 00 00 |..PartSI|Tx......|
|000007e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000007f0| 00 00 a9 80 1b 95 00 00 | 00 00 00 00 01 7e ff 3f |........|.....~.?|
|00000800| 00 08 fe f0 80 11 fd 80 | 40 11 e1 30 20 11 ef c8 |........|@..0 ...|
|00000810| 10 23 e1 7f 0f 23 c1 3c | 07 e3 c1 00 07 80 e0 80 |.#...#.<|........|
|00000820| 07 ff e0 60 07 ff e0 3f | e7 00 00 00 1f 00 00 00 |...`...?|........|
|00000830| 07 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000840| 00 01 ff ff c0 01 ff ff | c0 01 ff ff c0 00 ff ff |........|........|
|00000850| c0 00 ff ff c0 01 ff ff | c0 01 ff ff 80 01 ff fe |........|........|
|00000860| 00 03 ff fc 00 03 ff fc | 00 03 ff f8 00 07 ff f8 |........|........|
|00000870| 00 07 ff f0 00 07 ff f0 | 00 0f ff c0 00 0f ff 3f |........|.......?|
|00000880| 00 00 00 48 00 09 4d 6f | 6e 61 63 6f 00 74 68 20 |...H..Mo|naco.th |
|00000890| 66 69 6c 65 20 6f 70 65 | 6e 73 20 2a 2f 0d 0d 23 |file ope|ns */..#|
|000008a0| 69 6e 63 6c 75 64 00 06 | 00 04 00 48 00 0f 01 4b |includ..|...H...K|
|000008b0| 01 ec 00 48 00 0f 01 4b | 01 ec 9c ea 2a d4 00 00 |...H...K|....*...|
|000008c0| 00 8d 00 00 00 8d 00 00 | 00 00 01 00 00 00 01 00 |........|........|
|000008d0| 00 00 01 4c 00 00 00 4c | 00 00 00 32 00 01 64 e4 |...L...L|...2..d.|
|000008e0| 02 f2 00 00 00 1c 00 32 | 00 00 4d 50 53 52 00 00 |.......2|..MPSR..|
|000008f0| 00 0a 03 ed ff ff 00 00 | 00 00 00 02 66 38 00 00 |........|....f8..|
+--------+-------------------------+-------------------------+--------+--------+